<template>
  <el-form ref="formRef" :model="form" label-width="70px">
    <el-form-item label="小组名" prop="name" required>
      <el-input v-model="form.name" />
    </el-form-item>
    <el-form-item>
      <el-button type="primary" @click="submitForm">创建</el-button>
      <el-button @click="resetForm">重置</el-button>
    </el-form-item></el-form
  >
</template>

<script setup>
import { ref } from 'vue'
import { addsubject } from '@/api/subject'
import { ElMessage } from 'element-plus'
import store from '@/store'
import { creategroup } from '@/api/group'
const form = ref({
  userId: 0,
  deleted: false,
  name: ''
})
const submitForm = async () => {
  form.value.userId = store.getters.id
  creategroup(form.value)
  ElMessage({
    showClose: true,
    message: '班级创建成功',
    type: 'success'
  })
  resetForm()
}
const resetForm = () => {
  form.value = {
    userId: 0,
    deleted: false,
    name: ''
  }
}
</script>

<style lang="scss" scoped></style>
